// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()

const db = cloud.database()
const _ = db.command

// 云函数入口函数
exports.main = async (event, context) => {
  try {
    return await db.collection('legue').where({
      _id: event._id
    })
    .update({
      data: {
        legueName: event.legueName,
        introduction: event.introduction,
        addressresult: event.addressresult,
        leguetagresult: event.leguetagresult,
        demand: event.demand,
        username: event.username,
        class: event.class,
        phone: event.phone,
        qq: event.qq,
        weixin: event.weixin,
        email: event.email,
        like: event.like,
        lifeImagesIds: event.lifeImagesIds,
        consultImagesIds: event.consultImagesIds,
        status: event.status
      },
    })
  } catch(e) {
    console.error(e)
  }
}